static char *lonopt = NULL;
static char *exclopt = NULL;
static char *nosort = NULL;
+static char *maxctarg = NULL;
+static int maxct;
waypoint * home_pos;
NULL, ARGTYPE_BOOL },
{"nosort", &nosort, "Inhibit sort by distance to center.",
NULL, ARGTYPE_BOOL },
+ {"maxcount", &maxctarg,"Output no more than this number of points",
+ NULL, ARGTYPE_INT },
{0, 0, 0, 0, 0}
};
*/
for (i = 0; i < wc; i++) {
waypoint * wp = comp[i];
- waypt_add(wp);
+
xfree(wp->extra_data);
wp->extra_data = NULL;
+
+ if (maxctarg && i >= maxct) {
+ continue;
+ }
+ waypt_add(wp);
}
xfree(comp);
}
}
+ if (maxctarg) {
+ maxct = atoi(maxctarg);
+ } else {
+ maxct = 0;
+ }
+
home_pos = (waypoint *) xcalloc(sizeof(*home_pos), 1);
if (latopt)